home *** CD-ROM | disk | FTP | other *** search
/ Especial Multimedia / Especial Multimedia.iso / Multimed / Herra / SLANG10.ZIP / SLANG.TXT < prev    next >
Text File  |  1997-09-14  |  13KB  |  302 lines

  1. Algoritmic Images Editor SLANG 1.0
  2. (C) Stepan S. Vartanov, 1995
  3.  
  4. LICENZE.
  5.  
  6.      It is "AS IS". And it is SHAREWARE.
  7.      If you use Slang without licenze, and find it convenient
  8. to use, you should register. Registration fee is 50 $ USA -
  9. send check, money order or cash to:
  10. P.O.Box 34041 Scotia Square RPO, Halifax, N.S., Canada, B3J 3S1.
  11. To receive new versions add registration card in any form.
  12.  
  13. Version 1.0 is SHAREWARE. I used OOPic language interpreter to
  14. implement it. This interpreter is more flexible, than real SLANG
  15. interpreter, but have few nasty bugs. The v. 2.0 should use 
  16. real SLANG engine and hopefull, will be bug-free. Registered
  17. users of v. 1.0 will have disgrade for next versions (which
  18. will not be SHAREWARE, but commercial).
  19.  
  20. WHAT IS SLANG ?
  21.  
  22.      Slang is interactive editor of pictures in VEC format.
  23. It  use formulas to desvribe the image. All output could be
  24. scrolled, zoomed, rotated and printed on different types of
  25. printers. Export to BMP (DIB) format is also supported.
  26.  
  27. Installation.
  28.      Create  the  directory  (for example, "Slang") and copy
  29. the archive to it. Unpack it and then remove the archive.
  30. If instead of archivated  program,  your  disk  contains  non-
  31. archivated files, simply copy  them  to  the directory. Do not
  32. run SLANG from floppy disk - it is very ineffective.
  33.  
  34. How to work with SLANG.
  35.      Run SLANG.EXE.
  36.      There are 3 types of windows in SLANG. Text editor windows
  37. let you to edit VEC code. To execute code, choose SLANG/RUN
  38. from the menu. Output window work in the DOS-like manner. It
  39. show user input and SLANG output performed with PRINT function.
  40. If you check the Log file option in OPTIONS/.., this window
  41. create the OUTPUT.LOG file and copy all the output there. That
  42. is very usefull if you work with some data-processing program
  43. operating with the large data blocks. SLANG have other methods
  44. for file i/o, but only this way permits you see data in the
  45. output window while writing to file.
  46. View window shows graphical output of your program.
  47.  
  48.  
  49.      SLANG is an VEC language interpreter.
  50.  
  51. *)   If you are programmer. SLANG interprete BGI (DOS) or
  52. GDI (Windows). It is an exellent tool for maketing the graphic
  53. programs (no compiling delay, code and result are visible at
  54. the same screen).
  55.  
  56.      VEC is a very simple language, it could be studied in
  57. a few minutes. Default extention for VEC files is *.VEC.
  58.  
  59. ***********************************************
  60. WINDOWS VERSION OF SLANG.
  61. Main Menu, File.
  62. New          Creates new text file.
  63. Open         Loads program from file (but does not run it before RUN choosed.
  64. Save         Save program to file. If user choose RUN (draw program in the
  65.                view panel) the file saving is processed automatically.
  66. Save BMP     Copy image to BMP file. Be attentive with the zoom of image
  67.            (see) and with the buffer size. You will be prompted for the
  68.                image size, in pixels, and for the file name.
  69. Print Setup. Set up the printer.
  70. Print.       Print the image.
  71. About        Product info dialog.
  72.  
  73. ##################################################################
  74. LANGUAGE.
  75.  
  76.      You could use examples (*.VEC files) to study VEC.
  77. Here are the most important details.
  78.      Variables in SLANG could be used without declarations. Variable type
  79. will be determined using context:
  80.   x = 2 - type is REAL
  81.   x = "Hello" - type is STRING
  82.  
  83.   The only exeption are arrays. The array should be declared before use:
  84. Declaration:
  85. ARR[12]; (name ARR, 12 elements, semicolon is necessary in declaration)
  86. ...
  87. ARR[10] = 321 (usage).
  88.  
  89. Only array of REAL are supported. Array elements are numerated from 1 to n,
  90. where n is the number used in declaration. Any attempts to use wrong array
  91. indexes are ignored:
  92. A[10];
  93. a[5] = 12   ' OK
  94. a[50] = 2   ' Ignored
  95. __________________________________________________________________________
  96. User-defined functions could not get and return arrays. This situation
  97. will be changed in v. 2.0.
  98. __________________________________________________________________________
  99. Program consists of the sequence of operators. You can use more than one
  100. operator per line, delimiter is ':'. You also can continue the expression
  101. on the next line, connector is '\':
  102.  
  103. x = 1: y = 2: print x, y;
  104. x = 3 * (2 + 5 * r^2) - \
  105.     12 * k
  106.  
  107. There are two exeptions, array declarations:
  108. arr[12];
  109. and labels:
  110. #label
  111.     which should always start from the new line (in the case of array it
  112.     is not really necessary, but we recommend to do so).
  113. __________________________________________________________________________
  114. Functions (use examples).
  115. We shell use the following syntax:
  116. x = f(x1, s2, ar) - function takes 3 arguments, REAL, STRING and ARRAY
  117. and return REAL.  
  118. __________________________________________________________________________
  119. open(xa, s1) - open the file with file name s, set x1 to the file handle
  120. read(handle, buf <, len>) - read from file to the string, len is optional
  121.     argument - number of bytes to read
  122. write(handle, buf <, len>) see read()
  123. close(handle) - close the file
  124. x = eof(handle) - return 1 if end of file is reached, 0 otherwise
  125. x = filelen(handle) - return the length of file
  126. seek(handle, offset, fromwhere) - move current position of the file cursor
  127.     relatively to the file beginning, current position or end (0, 1 or 2)
  128. rename(oldname, newname) - rename the file
  129. setmode(handle, 1+3+5) set the file access mode.
  130. The values of second argument:
  131.  
  132. O_RDONLY         1
  133. O_WRONLY         2
  134. O_RDWR           4
  135.  
  136. x = getpos(handle) - get current file position
  137. remove(filename) - delete file
  138. next_line(handle) - skip one line in the file
  139. __________________________________________________________________________
  140. gettoken(string, token), tokens_string is delimited with , ;TAB('\9')
  141.     - parse the string, set string to string without first token, and
  142.     set token to the first part of string before delimiter
  143. x = getreal(string) - get the real from string
  144. puttoken(string, token) - append token to the end of string
  145. x = strcmp(s1, s2) - string comparison, return -1 if s1 < s2, 0 if s1 equial
  146.     s2, and 1 if s1 > s2
  147. x = strchr(s1, s2) - scan s1 for the substring s2, return 0 or 1.
  148. __________________________________________________________________________
  149. delete(variable name) - remove variable and free memory
  150. for i = startvalue to endvalue
  151.   ... continue - go to the next iteration
  152.   ... break j  - leave cycle of nested cycles, j is the outer cycle variable 
  153. next
  154.  
  155. if ... then ... else ... endif - if condition is TRUE, the block after
  156.     then gains the control, else otherwice.
  157.  
  158. @sub(arguments) - all user-defined subroutines have prefix @. It could
  159.     return value of string or real type.
  160. return
  161.   or
  162. return x
  163.  
  164. goto label - pass control to the specified label
  165. ...
  166. #label     - label line should contain only label with the # prefix
  167.  
  168. end        - end of the main flow of program or module (file)
  169.  
  170. ' This line is remarked
  171. /*
  172. This block
  173. is remarked
  174. */
  175. __________________________________________________________________________
  176. play(file name)  - unload current program, load <filename>, run it (it
  177.   should contain "end"-terminated main flow), load calling program and
  178.   return the control. Functions of calling program are not available,
  179.   variables are.
  180. lplay            - the same, but Functions of calling program are
  181.   available. Memory-consuming. Avoid nested calls!
  182. splay            - play string instead of file. Example - calculator with
  183.   the input from the keyboard.
  184. __________________________________________________________________________
  185. x = sin(x1) - sinus calculation, all trigon. functions use degrees, not
  186.     radians.
  187. x = cos(x1)
  188. x = lg(x1)
  189. __________________________________________________________________________
  190. print - output to the "output" window. Argument list should be divided by
  191. commas (no effect) or semicolons (new line). Tabulations {tab 3} and
  192. formatters {"%f"} could also be used.
  193. Examples:
  194.     print i, j, k, "hello", 3 + x;
  195.     print i, {tab 5}, {"10.2f"} d;
  196.        
  197. input - user will be prompted to input the data. Format is
  198.     INPUT <prompt string> argument, type of argument should be known:
  199.     x = 1  ' x has type REAL
  200.     input "Input x: ", x
  201.  
  202. pause x - not implemented, but the word is reserved for use in v. 2.0.
  203. __________________________________________________________________________
  204. line(x1, y1, x2, y2) - draw line from (left, top) to (right, bottom)
  205. lineto(x1, y1) draw line from the current position to x1, y1
  206. moveto(x1, y1) move the current position to x1, y1
  207. ellipse(xcenter, ycenter, alphastart, alphaend, radius1, radius2)
  208. rectangle(x1, y1, x2, y2)
  209. poly(num_of_points, x1, y1, ... xn, yn)
  210.  
  211. text(x1, y1, s1) - draw the string using current font
  212. textsize(multx, multy, divx, divy) - set font deformation
  213. font(s1) set font name (BGI fonts are used)
  214.  
  215. color(x1) - set color using 0 - 15 interval
  216. set_rgb(r, g, b) - set color using RGB triplet
  217. style(fill_style, fill_color) - set style (pattern) and color for filling
  218. fill(x1) - sett fill mode to OFF (0) or ON (1)
  219. setline(width, style) - set the line drawing width and style
  220. __________________________________________________________________________
  221. The following group of functions affect the image transformations.
  222. zoom(x1, y1) - set scaling coefficient for all the following drawing before
  223.     the next zoom call
  224. addzoom(x1, y1) - We use the agreement that zoom could be used in any time,
  225.     but addzoom - only once, at the beginning of the program. It sets the
  226.     additional scaling of the whole image.
  227. scroll(x1, y1) - scroll the picture
  228. addscroll(x1, y1) - additional scrolling, should be called only once
  229.  
  230. mirror(x1) - mirror reflection of the image relatively to the vertical line.
  231. Combined with the rotations could produce any reflection.
  232.  
  233. rotate(alpha, x1, y1) - all the following output will be rotated around
  234.     x1, y1 to alpha
  235. SLANG could perform nested rotations. To switch between simple and nested
  236.     modes use the ROT_ON and ROT_OFF operators, to reduce rotation level,
  237.     use ENDROTATE: 
  238.  
  239. rot_on
  240. for i = 0 to 36
  241.     rotate(i)
  242.     line(100, 100, 200, 200)
  243. next
  244. rot_off
  245. __________________________________________________________________________
  246. DIAGRAMMS support:
  247.  
  248. get_axes_dim(xmin, ymin, xmax, ymax) - sets arguments to the axes diapazone
  249.  
  250. set_axe - set the axe parameters.
  251. 'which, text dir, tick no (-1 for auto), s_tick no<,tick_ar, s_tick_arr>
  252. 'if auto (tick_no == -1) then number of sub ticks = s_tick_no * tick no
  253. 'in this case tick_no will be 5, sub_tick_no 25
  254. 'Manual ticks setup for X:
  255. Example:
  256. set_axe(1, 1, -1, 5, tar, tar, "One", "Two", "Three", "Four", "Five", "Six")
  257. For more examples see graf.vec.
  258.  
  259. axes - draws axes
  260. 'Axes numeration: HORIZ1 = 1, VERT1 = 2, HORIZ2 = 4, VERT2 = 8
  261. Example:
  262. axes(YELLOW, LIGHTBLUE, 0, GREEN, 3, 1, 1 + 2)
  263. 'axes color, legends color, grid style, grid color, axes width, ticks width,
  264. 'axes set (hor1 + vert1)
  265. For more examples see graf.vec.
  266.  
  267. cross() - draws 2 lines throught (0,0)
  268. calc_scale - set the axe scale
  269. '  Given: Array of REAL ............................ xar
  270. '       Axe (0 - X, 1 - Y) ...................... axe
  271. '       Reset or not previous settings .......... is_first
  272. '       Justification method .................... int num_flag
  273. 'is_first indicates, is it necessary to use previous scale PLUS new data,
  274. '    or only new data.
  275. 'num_flag could be -1, 0 and 1. -1 is used for bar graphs to resize axe.
  276. '    It is necessary because few bars use additional space - and will not
  277. '    fit on graphics otherwise.
  278. '    0 does not produce any action.
  279. '    1 recalculate axe to produce nice-looking labels, Remember that call to
  280. '    set_axe() will automatically presume that axes are "nice-looking",
  281. '    so you MUST call set_axe() with -1 setting or not to use auto labels.
  282. Example:
  283. calc_scale(xar, 0, 1, -1, xd)
  284. For more examples see graf.vec.
  285.  
  286. get_stacked(xar, zar) - We have 2 arrays, second is the "base", we already
  287. have plot it, and first is the array to plot. Type of graf is STACKED BAR
  288. GRAF. Call to get_stacked add second array elements to the elements of the
  289. first array to produce new base for the next dataset.
  290. '                zar[4*i+1] keep ystart < 0;
  291. '         zar[4*i+2] keep ystart >= 0;
  292. '         zar[4*i+3] keep yend < 0;
  293. '         zar[4*i+4] keep yend >= 0;
  294. For more examples see graf.vec.
  295.  
  296. grafclip(x1, y1, x2, y2) - set the graf clip rectangle
  297. grafscale(x1, y1, x2, y2) - set the graf min and max data values. Used for
  298.     manual setup - see graf.vec
  299. marker_size - size of marker, pixels
  300. plot(xarray, yarray, graftype, markertype, shifts) - plot the dataset.
  301.     Shifts are used for BAR GRAFs, because it could need some extra space.
  302.     See GRAF.VEC for explanations.